//导入swiper3D_api接口:
import { reqCategoryList, mockReqBannerList, mockReqFloorList, reqlikeInfo, reqbrandInfo, reqrecommendInfo, reqrankInfo, reqnewswiperInfo,reqswiper3DInfo } from '@/api'
const state = {

    categoryList: [],
    getBannerList: [],
    getFloorList: [],
    getlikeList: [],
    getBrandList: [],
    getrecommendlist: [],
    getranklist: [],
    newswiper: [],
        //引入swiper3D的接收数组:
        getswiper3D:[]
    
}
const mutations = {
    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList
    },
    GETBANNERLIST(state, bannerList) {
        state.getBannerList = bannerList
    },
    GETFLOORLIST(state, floorList) {
        state.getFloorList = floorList
    },
    GETLIKELIST(state, likeList) {
        state.getlikeList = likeList
    },
    GETBRSNDLIST(state, brandList) {
        state.getBrandList = brandList
    },
    GETRECOMMENDLIST(state, recommendlist) {
        state.getrecommendlist = recommendlist
    },
    GETRANKLIST(state, ranklist) {
        state.getranklist = ranklist
    },
    GETNEWSWIPERINFO(state, newswiper) {
        state.newswiper = newswiper
    },
     //getswiper3D的计算属性赋值:
     GETSWIPER3DINFOR(state,swiper3D){
        state.getswiper3D = swiper3D
    }
}
const actions = {

    async categoryList({ commit }) {
        let result = await reqCategoryList()
        if (result.code === 200) {
            commit('CATEGORYLIST', result.data)

        }

    },
    async getBannerList({ commit }) {
        let result = await mockReqBannerList()
        if (result.code === 200) {
            commit('GETBANNERLIST', result.data)


        }

    },
    async getFloorList({ commit }) {
        let result = await mockReqFloorList()
        if (result.code === 200) {
            commit('GETFLOORLIST', result.data)


        }

    },
    async getlikeList({ commit }) {
        let result = await reqlikeInfo()

        if (result.code === 200) {
            commit('GETLIKELIST', result.data)

        }

    },
    async getbrandList({ commit }) {
        let result = await reqbrandInfo()

        if (result.code === 200) {

            commit('GETBRSNDLIST', result.data)
        }
    },
    async getrecommendList({ commit }) {
        let result = await reqrecommendInfo()

        if (result.code === 200) {


            commit('GETRECOMMENDLIST', result.data)
        }
    },
    async getrankList({ commit }) {
        let result = await reqrankInfo()

        if (result.code === 200) {


            commit('GETRANKLIST', result.data)
        }
    },
    async getnewswiperInfo({ commit }) {
        let result = await reqnewswiperInfo()
        if (result.code === 200) {
            commit('GETNEWSWIPERINFO', result.data)
        }
    },
    //接收home发过来的
    async getswiper3DInfor({commit}){
       let result = await reqswiper3DInfo()
       if(result.code === 200){
           commit("GETSWIPER3DINFOR",result.data)
       }}
}
const getters = {}
export default {
    state,
    mutations,
    actions,
    getters,

}